<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="{{ asset('/admins/css/bootstrap.min.css') }}" rel="stylesheet"> 
    <script src="{{ asset('/admins/js/jquery.min.js') }}"></script>
    <script src="{{ asset('/admins/js/bootstrap.min.js') }}"></script>
</head>
<body>
   <div class="col-lg-12" style="margin-top:30px;">
    @if(session('success'))
       <div class="alert alert-danger">
            {{ session('success') }}
       </div>
    @endif
    <div class="panel panel-default">
        <div class="panel-heading">
            商品列表 
        </div>
        <!-- /.panel-heading -->
        <div class="panel-body">
            <div class="dataTable_wrapper">
                <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                    <div class="row">
                       
                        <div class="col-sm-6">
                            <div class="dataTables_length" id="dataTables-example_length">
                            <label>显示 
                                <select name="num" aria-controls="dataTables-example" class="form-control input-sm">
                                    <option value="10">10</option>
                                    <option value="25">25</option>
                                    <!--{ selected } selected 前后必须有空格-->
                                    <option value="50">50</option>
                                    <option value="100">100</option>
                                </select> 条
                            </label>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div id="dataTables-example_filter" class="dataTables_filter">
                                <label>商品名:
                                    <input name="name" value="" class="form-control input-sm" placeholder="" aria-controls="dataTables-example" type="search">
                                </label>
                                <button class="btn btn-info">查询</button>
                                <form action="/admin/goodsmain/create" method="get" style="float:right">
                                    <input type="hidden" name='id' value="{{$id}}">
                                    <input type="submit" class="btn btn-primary" value="添加商品颜色分类">
                                </form>
                            </div>
                        </div>
                        
                        <form name='myform' action='{{ url("/admin/goodscate") }}' method='post'>
                            {{ csrf_field() }}

                            {{ method_field('delete') }}

                        </form>
                        </div><div class="row"><div class="col-sm-12">
                        
                        <table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" role="grid" aria-describedby="dataTables-example_info">
                    <thead>
                        <tr role="row">
                            <th class="sorting_asc" style="width:80px;" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending">商品编码</th>
                            <th class="sorting" style="width:260px;" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">商品标题</th>
                            <th class="sorting" style="width:260px;" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">副标题</th>
                            <th class="sorting" style="width:260px;" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending">颜色</th>
                            <th class="sorting" style="width:200px;" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending">价格</th>
                            <th class="sorting" style="width:100px;" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">商品图片(主图)</th>
                            <th class="sorting" style="width:200px;" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending">状态</th>
                            <th class="sorting" style="width:180px;" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending">操作</th>
                        </tr>
                    </thead>
                    <tbody> 
                      @foreach($goods as $v)
                        <tr class="gradeA odd" role="row">
                            <td class="sorting_1 sid">{{$v->code}}</td>
                            <td class="sorting_1 sid">{{$v->title}}</td>
                            <td>{{$v->ftitle}}</td>
                            <td>{{$v->colour}}</td>
                            <td>华为价:{{$v->hwprice}}<br>现价：{{$v->price == '' ? "无优惠" : $v->price}} </td>
                            <td>@if(!empty($v->pic0))<img src="/uploads/{{$v->pic0}}" width="100">@else <img src="/uploads/mask.png" width="100"> @endif</td>
                            <td class="center">{{$v->status == 1? "显示中" : "未显示"}}<br>销量：{{ $v->sales }}<br>库存：{{ $v->stock }}</td>
                            <td class="center">
                                <a href="javascript:doDel({{ $v->id }}) "<span="" class="fa fa-trash-o delete"> 删除</a> | 
                                <a href="/admin/goodsmain/{{$v->code}}/edit" <span="" class="fa fa-wrench"> 修改</a>
                            </td>
                        </tr>
                      @endforeach
                       
                    </tbody>
                </table>
                <script type="text/javascript">
                function doDel(id)
                {
                    if(confirm('请君三思')){
                        var form = document.myform;
                        form.action = '/admin/goodsmain/'+id;
                        form.submit();
                    }
                }
                    
                </script>
            </div>
        </div>
                                <div class="row"><div class="col-sm-6"><div class="dataTables_info" id="dataTables-example_info" role="status" aria-live="polite">
                                
                                当前 1 - 10 总共 条
                                </div></div>
                                <div class="col-sm">
                                   

                                </div></div></div>
                            </div>
                            <!-- /.table-responsive -->
                           
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
